package com.qiantu.phone.ui.shotview;

import static com.qiantu.phone.ui.uiutil.LLDeviceUtil.STROKE_PERCENTAGE;

import android.content.Context;
import android.text.TextUtils;

import com.qiantu.phone.R;
import com.qiantu.phone.ui.uiutil.LLDeviceUtil;
import com.qiantu.phone.widget.KHCurtainSeek;
import com.qiantu.phone.widget.RollerShutterSeek;
import com.qiantu.phone.widget.StatusSeekBar;
import com.qiantu.phone.widget.VerticalStatusSeekBar;

public class BFCurtainShotView extends BaseDeviceActView{
    private KHCurtainSeek curtainSeek;
    //    private VibratorManager mVibratorManager;
    private StatusSeekBar statusSeekBar;

    public BFCurtainShotView(Context context) {
        super(context);
    }

    @Override
    public int getLayoutId() {
        return R.layout.bf_curtain_shot_view;
    }

    @Override
    public void initView() {
        curtainSeek = findViewById(R.id.curtain_seek);
        statusSeekBar = findViewById(R.id.status_seek_bar);
        curtainSeek.setOnChangeListener(new KHCurtainSeek.OnChangeListener(){
            @Override
            public void onStartTrackingTouch() {

            }

            @Override
            public void onProgressChanged(int value) {

            }

            @Override
            public void onValueChanged(int progress) {
                addAct(STROKE_PERCENTAGE, (100 - progress) + "");
            }
        });
        statusSeekBar.setOnSeekBarChangeListener(new StatusSeekBar.OnSeekBarChangeListener() {
            @Override
            public void onValueChanged(int value) {
            }

            @Override
            public void onStartTrackingTouch() {

            }

            @Override
            public void onStopTrackingTouch(int value) {
                addAct(LLDeviceUtil.AMGLE, value + "");
            }
        });
    }

    @Override
    public void updateView() {
        //根据已保存动作指令集合更新UI
        String strokePercentage = getState(STROKE_PERCENTAGE, null);
        if(TextUtils.isEmpty(strokePercentage)){
            curtainSeek.isNotSet(true);
        }else{
            curtainSeek.setProgress(100 - Integer.valueOf(strokePercentage));
        }
    }
}
